Crate server_env_config
source ·Expand description
Util types and functions to quickly and easy set up an HTTP server from environment variables.
See Config::init()
for examples.
Modules
- The
DbConfig
struct represents settings used to establish a connection with a database. - The
Environment
enum represents possible deployment environments for an application. - The
HttpServerConfig
struct represents configuration for an HTTP server.
Structs
Config
is responsible of the configuration of a “full” server, reading the settings from environment variables: the deployment environment, the HTTP server settings and database settings.
Functions
- Read boolean environment variable, accepting “0” or “false” as false values, and “1” or “true” values as true.
- Get a parsable value from an env value like a number, otherwise return
default_value
.